package com.hluck.mvvmlibrary.network.observer;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * @Author： LJH
 * @Time： 2023/12/22
 * @description：
 */
public abstract class BaseObserver<T> implements Observer<T> {

    //开始
    @Override
    public void onSubscribe(@org.jetbrains.annotations.NotNull Disposable d) {

    }

    //继续
    @Override
    public void onNext(@org.jetbrains.annotations.NotNull T t) {
        onSuccess(t);
    }

    //异常
    @Override
    public void onError(@org.jetbrains.annotations.NotNull Throwable e) {
        onFailure(e);
    }

    //完成
    @Override
    public void onComplete() {

    }

    //成功
    public abstract void onSuccess(T t);

    //失败
    public abstract void onFailure(Throwable e);
}
